import { createPinia } from '@peng_kai/kit/libs/pinia';
import { useAppStore } from './app';
import { useCurrencyStore } from './currency';
import { useUserStore } from './user';

export default defineStartup(async (app) => {
  app.use(createPinia());

  app.config.globalProperties.$store = {
    app: useAppStore(),
    user: useUserStore(),
    currency: useCurrencyStore(),
  };
});

interface TStores {
  app: ReturnType<typeof useAppStore>;
  user: ReturnType<typeof useUserStore>;
  currency: ReturnType<typeof useCurrencyStore>;
}

declare module 'vue' {
  interface ComponentCustomProperties {
    $store: TStores;
  }
}
